<?php
namespace Mobile\Controller;

use Common\Controller\MHomeBaseController;

/**
 * 首页控制器
 */
class IndexController extends MHomeBaseController
{
    /**
     * 首页
     */
    public function index()
    {

        //公告
        $Notice              = M('Article');
        $map['ac_id']        = 10;
        $map['article_show'] = 1;
        $notice              = $Notice->field('article_content')->where($map)->order('article_sort asc ,article_time desc')->select();

        //首页轮播图
        $Banner  = M('Banner');
        $banners = $Banner->field('adv_pic')->where('adv_site=1')->select();
        //开奖结果
        $lottery = S('lottry_array');
        foreach ($lottery as $k => $v) {
            $results              = M('lottery_results')->field('c_no,lottery_result')->where('c_id=' . $k)->order('c_no desc')->find();
            $result[$k]['result'] = $results['lottery_result'];
            $result[$k]['c_no']   = $results['c_no'];
        }

        $this->assign('result', $result);
        $this->assign('notice', $notice);
        $this->assign('banners', $banners);
        $this->assign('title', '首页-皇彩鸿娱乐平台');
        $this->assign('curr', 'index');
        $member_id   = session('member_id');
        $member_name = session('member_name');
        $this->assign('member_id', $member_id);
        $this->assign('member_name', $member_name);
        $this->display();
    }

    public function check_session()
    {
        if ($_SESSION['member_id'] > 0) {
            $data['status'] = 0;
            $this->ajaxReturn($data);
        } else {
            $data['status'] = 1;
            $this->ajaxReturn($data);
        }
    }

}
